<%@ page language="java" pageEncoding="UTF-8"%>
<div ng-controller="CommentIndexController">

	<div ng-show="comments.data_sum==0 || comments.data.length==0">
		<div class="alert alert-info"><i class="glyphicon glyphicon-exclamation-sign"></i> 目前尚未有评论。</div>
	</div>
	
	<div>
		<div ng-repeat="comment in comments.data">
			<include path="/comment_layout.html"></include>
			<div style="color: #999;font-size: 12px;" class="pull-right">
				<span user-login>
					<i class="glyphicon glyphicon-plus-sign"></i> <a href="javascript:void(0)" style="color: #999;" ng-click="quote.create(comment);">添加引用</a>
				</span>
				
				<span ng-show="comment.quoteData!=null">
					<i class="glyphicon glyphicon-comment"></i> <a href="javascript:void(0)" style="color: #999;" ng-click="quote.close(comment);">收起引用</a>
				</span>
				
				<span ng-show="comment.quote_count!=0 && comment.quoteData==null">
					<i class="glyphicon glyphicon-comment"></i> <a href="javascript:void(0)" style="color: #999;" ng-click="quote.show(comment);">{{comment.quote_count}} 条引用</a>
				</span>
			</div>
			
			<br/>
			<div class="panel panel-default" ng-show="comment.quoteData!=null">
				<div class="panel-body">
					<div ng-repeat="comment in comment.quoteData.data">
						<include path="/comment_layout.html"></include>
					</div>
					<button ng-show="comment.more" type="button" class="btn btn-default btn-lg btn-block" ng-click="quote.more(comment)">更多</button>
				</div>
			</div>
			<hr/>
		</div>
		
		<paginate page-count="comments.page_count" sum="comments.data_sum" pn="comments.pn" click="comment.find"></paginate>
		<hr/>
	</div>
	
	<div message="请先登录" user-login>
		<form role="form" callback="comment.create" validate>
			<textarea name="content" rule="required;length[5~1000];" ng-model="comment.content" editor-width="100%" delay="0" editor></textarea>
			<br/>
			<button type="submit" class="btn btn-success btn-sm"><i class="glyphicon glyphicon-ok-sign"></i> 发送评论</button>
		</form>
		<br/>
	</div>
</div>